<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
include("meses.php");
include("conexion.php");

$conexion=conexion();
$numpalabras=$_GET['numpalabras'];
$nummes=$_GET['nummes'];
$nombremes=$meses[$nummes];
$databary=array();
$months=array();

$consulta=mysql_query("SELECT * FROM pormes WHERE mes=$nummes ORDER BY repeticiones DESC LIMIT 0,$numpalabras",$conexion);
		while($resultados=mysql_fetch_assoc($consulta)){
			array_push($databary,$resultados[repeticiones]);
			array_push($months,$resultados[palabra]);
			
		}
	







// New graph with a drop shadow
$graph = new Graph(500,200,'auto');
$graph->SetShadow();

// Use a "text" X-scale
$graph->SetScale("textlin");

// Specify X-labels
$graph->xaxis->SetTickLabels($months);

// Set title and subtitle
$graph->title->Set("Top $numpalabras palabras de $nombremes" );

// Use built in font
$graph->title->SetFont(FF_FONT1,FS_BOLD);

// Create the bar plot
$b1 = new BarPlot($databary);
$b1->SetLegend("Palabras");

//$b1->SetAbsWidth(6);
//$b1->SetShadow();

// The order the plots are added determines who's ontop
$graph->Add($b1);

// Finally output the  image
$graph->Stroke();

?>
